package com.poposchool.project.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

/**
 * @Author Wang Jie
 * @Date 2022/6/28 12:40
 * @Version 1.0
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
/**
 * 接口返回对象
 */
public class Result {
    private String code;
    private String msg;
    private Object data;

    public static Result success(){
        return new Result(Constants.CODE_200,"",null);
    }

    public static Result success(Object object){
        return new Result(Constants.CODE_200,"",object);
    }

    public static Result success(String msg){
        return new Result(Constants.CODE_200,msg,null);
    }

    public static Result success(String code,String msg,Object data){
        return new Result(code,msg,data);
    }

    public static Result error(String code,String msg){
        return new Result(code,msg,null);
    }

    public static Result error(String code,String msg,String data){
        return new Result(code,msg,data);
    }

}
